package com.tamtamy.jtta.data.json;

import net.sf.json.JSONObject;

import com.tamtamy.jtta.data.ContentWidget;
import com.tamtamy.jtta.utility.JSONUtility;

public class JSONContentWidget extends ContentWidget {

	private static final long serialVersionUID = 7050155627119875331L;

	public JSONContentWidget(JSONObject jsonObject) {
		super();		
		this.id = JSONUtility.getLong(jsonObject, "id");
		this.title = JSONUtility.getString(jsonObject, "title");
		this.description = JSONUtility.getString(jsonObject, "description");
		this.creationDate = JSONUtility.getDate(jsonObject, "creationDate");
		this.userID = JSONUtility.getString(jsonObject, "userID");
		this.languageCode = JSONUtility.getString(jsonObject, "languageCode");
		this.network = JSONUtility.getString(jsonObject, "network");
		this.permission = JSONUtility.getString(jsonObject, "permission");
		this.discussionPermission = JSONUtility.getString(jsonObject, "discussionPermission");	
		this.updateDate = JSONUtility.getDate(jsonObject, "updateDate");
		this.favouriteCounter = JSONUtility.getString(jsonObject, "favouriteCounter");
		this.highlight = JSONUtility.getString(jsonObject, "highlight");
		this.numberOfComments = JSONUtility.getString(jsonObject, "numberOfComments");
		this.rateEnabled = JSONUtility.getString(jsonObject, "rateEnabled");
		this.tags = JSONUtility.getStringList(jsonObject, "tagList");
		this.rate =  JSONUtility.getString(jsonObject, "rate");
		this.ratesNumber =  JSONUtility.getString(jsonObject, "ratesNumber");
		this.commentList = JSONUtility.getStringList(jsonObject, "commentsList");
		this.views = JSONUtility.getString(jsonObject, "views");
		this.downloads = JSONUtility.getString(jsonObject, "downloads");
		this.thumbnailPresent = JSONUtility.getBoolean(jsonObject, "thumbnailPresent");
		this.thumbnailSmall = JSONUtility.getString(jsonObject, "thumbnailSmall");
		this.thumbnailRect = JSONUtility.getString(jsonObject, "thumbnailRect");
		this.thumbnailMedium = JSONUtility.getString(jsonObject, "thumbnailMedium");
		this.thumbnailOriginal = JSONUtility.getString(jsonObject, "thumbnailOriginal");
		this.contentUrl = JSONUtility.getString(jsonObject, "contentUrl");
		this.contentType = JSONUtility.getString(jsonObject, "contentType");
		this.contentTypeCategory = JSONUtility.getString(jsonObject, "contentTypeCategory");
		this.size = JSONUtility.getString(jsonObject, "size");
		this.descriptionPlainText = JSONUtility.getString(jsonObject,"descriptionPlainText");
		this.permalink = JSONUtility.getString(jsonObject,"permalink");
	}

}
